package com.dsj.gxrd.modules.controller.activity;

import com.dsj.gxrd.modules.activity.domain.entity.RdFeedBack;
import com.dsj.gxrd.modules.activity.domain.entity.RdScoreDetail;
import com.dsj.gxrd.modules.activity.domain.vo.RdOverviewVo;
import com.dsj.gxrd.modules.activity.service.RdFeedbackService;
import com.dsj.gxrd.modules.activity.service.RdOverviewService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author songpin566
 * @date 2023/10/17
 **/
@RestController
@Api("代表之家")
@RequestMapping("/feed/back")
public class RdFeedbackController extends BaseController {

    @Autowired
    private RdFeedbackService rdFeedbackService;

    /**
     * 后台代表之声查询
     */
    @RequiresPermissions("feed:back:list")
    @GetMapping("/list")
    public TableDataInfo list(RdFeedBack feedBack) {
        startPage();
        List<RdFeedBack> list = rdFeedbackService.selectFeedbackList(feedBack);
        return getDataTable(list);
    }

    @RequiresPermissions("feed:back:add")
    @PostMapping()
    public AjaxResult add(@RequestBody RdFeedBack feedBack) {
        return toAjax(rdFeedbackService.addFeedBack(feedBack));
    }

    /**
     * 转办
     */
    @RequiresPermissions("feed:back:transfer")
    @PostMapping("/transfer")
    public AjaxResult transfer(@RequestBody RdFeedBack feedBack) {
        return toAjax(rdFeedbackService.transfer(feedBack));
    }

    /**
     * 发布
     */
    @RequiresPermissions("feed:back:public")
    @GetMapping("/public")
    public AjaxResult isPublic(Long id) {
        return toAjax(rdFeedbackService.isPublic(id));
    }

    /**
     * 办理
     */
     @RequiresPermissions("feed:back:handle")
    @PostMapping("/handle")
    public AjaxResult handle(@RequestBody RdFeedBack feedBack) {
        return toAjax(rdFeedbackService.handle(feedBack));
    }

}
